import request from '@/utlis/request'

/**
 * 获取所有频道列表
 */
export const reqGetChannels = () => request({
  url: '/v1_0/channels'
})

/**
 *加载文章列表
 * @param {*} id 频道id
 * @param {*} timestamp 时间戳
 */
export const reqGetArticleList = (id, timestamp) => request({
  method: 'get',
  url: '/v1_0/articles',
  params: {
    channel_id: id,
    timestamp
  }
})

/**
 * 对文章不喜欢
 * @param {string} id 文章id
 * @returns
 */
export const reqDislikeArticle = (id) => request({
  method: 'post',
  url: '/v1_0/article/dislikes',
  data: { target: id }
})

/**
 *举报文章
 * @param {*} target 举报文章ID
 * @param {*} type 举报类型
 * @param {*} remark 其他问题的附加说明
 * @returns
 */
export const reportArticle = (target, type, remark) => request({
  method: 'post',
  url: '/v1_0/article/reports',
  data: { target, type, remark }
})

/**
 * 获取用户的频道
 * @returns
 */
export const reqGetMyChannels = () => request({
  url: '/v1_0/user/channels'
})

/**
 * 添加用户频道
 * @param {*} id 频道id
 * @param {*} seq 顺序
 * @returns
 */
export const reqAddMyChannel = (channels) => request({
  method: 'put',
  url: '/v1_0/user/channels',
  data: { channels }
})

/**
 *删除用户频道
 * @param {*} channels 现有频道列表
 */
export const reqDelMyChannel = (channels) => request({
  method: 'delete',
  url: '/v1_0/user/channels',
  data: { channels }
})
